package com.zyl.blog.service;/**
 * @author 14323
 * @date 2020/8/8 11:59
 */

import com.zyl.blog.dao.UserRepository;
import com.zyl.blog.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

/**
 * @Description: TODO
 * @author: scott
 * @date: 2020年08月08日 11:59
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public User checkUser(String username, String password) {
        String MD5Password = DigestUtils.md5DigestAsHex(password.getBytes());
        System.out.println(MD5Password);
        User user = userRepository.findByUsernameAndPassword(username, MD5Password);
        return user;
    }
}
